package org.wlci.captur.application.customer;

import java.util.ArrayList;
import java.util.List;

import javax.ejb.EJB;

import org.wlci.captur.beans.TestBeanRemote;

public class MaintainCustomer {

	@EJB
	private static TestBeanRemote maintainPatient;
	
	public String sayHello() {
		
//		try {
//		
//			InitialContext ic = new InitialContext();
//			
//			maintainPatient = (TestBean2)ic.lookup( "TestBeanLocal" );
//			
//		} catch( Exception pEx ) {
//			pEx.printStackTrace();
//		}
		
		maintainPatient.test();
		return null;
	}

	private List<Customer> customers = new ArrayList<Customer>();
	
	private Customer customer = new Customer();
	private Customer customerToDelete;
	
	public String addCustomer() {
		
		System.out.println( "Adding customer!" );
		
		customers.add( customer );
		customer = new Customer();
		
		return null;
	}

	public String deleteCustomer() {
		customers.remove( customerToDelete );
		return null;
	}
	
	public void setCustomerToDelete( Customer customer ) {
		customerToDelete = customer;
	}

	public Customer getCustomer() {
		return customer;
	}

	public void setCustomer(Customer customer) {
		this.customer = customer;
	}

	public List<Customer> getCustomers() {
		return customers;
	}
	
}
